/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;
import bmg.Address;
import bmg.Customer;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Propriétaire
 */
public class ShoppingCart implements Serializable
{
    private Address address;
    private Customer customer;
    
    private List<Order> orders;

    public ShoppingCart()
    {
        orders = new ArrayList<Order>();
    }
    
    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public int getCount() {
        int count = 0;
        for(Order o : this.orders)
        {
            count = count + o.getQuantity();
        }
        return count;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public List<Order> getOrders() {
        return orders;
    }

    public void setOrders(List<Order> orders) {
        this.orders = orders;
    }
    
    public int getTotal()
    {
        int total = 0;
        for(Order o : this.orders)
        {
            total = total + o.getPrice()*o.getQuantity();
        }
        return total;
    }
}
